<template>
	<div>
		<van-tabs>
			<van-tab :title="v.category_name" v-for="(v, i) in online_list" :key="i">
				<div v-for="(item, index) in v.series_list" :key="index">
					<van-cell v-if="item.type === '1002'">
						<template #icon>
							<img :src="item.info.image_url" width="100" height="60" />
						</template>

						<template #extra>
							<van-button type="primary">询问底价</van-button>
						</template>

						<h3>{{ item.info.series_name }}</h3>
						<p>{{ item.info.price }}</p>
						<p>{{ item.info.official_price }}</p>
					</van-cell>

					<van-cell v-if="item.type === '1003'">
						<template #title>
							<h3>{{ item.info.sub_brand_name }}</h3>
						</template>
					</van-cell>
				</div>
			</van-tab>
		</van-tabs>
	</div>
</template>


<script setup lang="ts">
import { fetchCarDetail } from '@/api'
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
const route = useRoute()
const online_list = ref<any>([])
onMounted(() => {
	fetchCarDetail({
		brand_id: route.params.brand_id as string,
		device_id: '0',
		city_name: '上海'
	}).then(resp => {
		online_list.value = resp.data.data.online_list
		console.log(online_list.value);
	})
})
</script>